home *** CD-ROM | disk | FTP | other *** search
/ PsL Monthly 1993 December / PSL Monthly Shareware CD-ROM (December 1993).iso / prgmming / dos / pascal / drivexx.exe / DRVDEMO.PAS < prev    next >
Pascal/Delphi Source File  |  1993-01-22  |  6KB  |  169 lines

  1. (******************************************************************************)
  2. (*                              PROGRAM DRVDEMO                               *)
  3. (*                                                                            *)
  4. (*                                Version 4.00                                *)
  5. (*                                                                            *)
  6. (*              Copyright (C) 1991, 1992 by FeerKnott Computing               *)
  7. (*                                                                            *)
  8. (*                            3922 Englewood Drive                            *)
  9. (*                            Champaign, IL  61821                            *)
  10. (*                                                                            *)
  11. (*                           (217) 355-8145 (voice)                           *)
  12. (*                           (217) 355-9661 (modem)                           *)
  13. (*                              CIS [71160,1045]                              *)
  14. (*                                                                            *)
  15. (*                             ALL RIGHTS RESERVED                            *)
  16. (******************************************************************************)
  17.  
  18. (******************************************************************************)
  19. (*      Written by:  Charles B. Little, Ph.D.                                 *)
  20. (*         Version:  4.00                                                     *)
  21. (*   Revision Date:  29 November 1992                                         *)
  22. (*         Purpose:  To demonstrate the use of unit DRIVExx - ver 4.00 - to   *)
  23. (*                   obtain important information about disk drives.          *)
  24. (******************************************************************************)
  25.  
  26. {$S-,R-}
  27.  
  28. PROGRAM DRVDEMO;
  29.  
  30. USES DOS, CRT, DRIVExx;
  31.  
  32. {$I drvdemo.inc}
  33.  
  34. var index : char;
  35.     X     : longint;
  36.     DP    : fakeDPB;
  37.     G     : word;
  38.  
  39. BEGIN
  40.   clrscr;
  41.   if DriveError <> 0 then
  42.   begin
  43.     ShowDriveError;
  44.     clrscr;
  45.   end;
  46.  
  47.   Openingscreen;
  48.  
  49.   for index := 'A' to chr($60) do    { $5B thru $60 are for Novell drives }
  50.   begin
  51.     positioncursor;
  52.     if DrivExists(index) then
  53.     begin
  54.       writeln;writeln(index,':');
  55.       write('BIOS #',ShowBIOSDriveNum(index),', ');
  56.       if DriveisNormal(index) then
  57.       begin
  58.         write('normal:');
  59.         if DriveisRemovable(index) then
  60.         begin
  61.           write(' removable');
  62.           case RemovableDrivetype(index) of
  63.           $FF :  write(', Drivetype error $FF');
  64.             1 :  write(', 5.25" DD');
  65.             2 :  write(', 5.25" HD');
  66.             3 :  write(', 3.5" DD');
  67.             4 :  write(', 3.5" HD');
  68.             5 :  write(', 3.5" QD');
  69.             6 :  write(', Tape');
  70.             7 :  write(', Bernoulli');
  71.             8 :  write(', CDROM');
  72.             else write(', type = ?');
  73.           end; {case}
  74.           if ChangeLineSupported(index) then
  75.             if DiskWasChanged(index) then write(', changed')
  76.             else write(', not changed');
  77.         end
  78.         else
  79.         begin
  80.           if DriveisHard(index) then write(' hard');
  81.           if DriveisRAMDisk(index) then write(' RAMDisk');
  82.           if DriveisOtherfixed(index) then write(' unknown fixed');
  83.         end;
  84.         X := DiskSyze(index);
  85.         {can't use LONGINT variables as selectors in case statements, so we
  86.          must handle DiskSyze in a less than elegant way}
  87.         if (X = -1) then write(', size = error')
  88.         else
  89.           if (X = 0) then write(', size = ?')
  90.           else
  91.             write(', size = ',X);
  92.         if (DriveMappedTo(index) <> index) then
  93.           write(', attached to ',DriveMappedTo(index),':');
  94.  
  95.       end {driveisnormal}
  96.       else
  97.       begin
  98.         write('abnormal:');
  99.         if DriveisPhantom(index) then
  100.           write(' phantom, mapped to ',DriveMappedTo(index),':');
  101.         if DriveisAliased(index) then
  102.         begin
  103.           if DRDOS then write(' aliased')
  104.           { DRDOS reports SUBST when *either* ASSIGN or SUBST is used.  Since
  105.             we cannot verify that NETWORK and IFS will be reported correctly
  106.             under DRDOS, we recommend that the generic "aliased" be used to
  107.             classify ALL of these situations below when running under that OS }
  108.           else
  109.           begin
  110.             if DriveisJoined(index) then write(' joined');
  111.             if DriveisSubsted(index) then write(' substituted');
  112.             if DriveisAssigned(index) then
  113.                 write(' assigned to ',DriveMappedTo(index),':');
  114.           end;
  115.         end;
  116.         if DriveisNetwork(index) then write(' network');
  117.         if DriveisIFS(index) then write(' IFS');
  118.       end; {driveisabnormal}
  119.  
  120.       {the following apply to all drives, normal or abnormal}
  121.       writeln;
  122.       if DriveisNONDOS(index) then writeln('Drive is NON-DOS (not IBM block format)');
  123.       if (NetWareLoaded and DriveIsNetwork(index)) then
  124.         writeln('Drive flag = ',GetNetwareDriveType(index))
  125.       else
  126.         writeln('Logged Directory is ',CurrentDir(index));
  127.       writeln('Physical type code = ',physicaltype(index));
  128.     end; {if drivexists}
  129.   end; {for index := 'A' to ''' do}
  130.  
  131.  
  132.   writeln;writeln;
  133.   write('Enter a drive letter to demonstrate function GETDPB ');
  134.   index := readkey;
  135.   if (not drivexists(index)) and (not driveisnormal(index)) then halt;
  136.   clrscr;
  137.  
  138.   G := GETDPB(index,DP,false);
  139.   if (G = 0) then {FALSE means don't hit the disk}
  140.   begin
  141.     writeln;
  142.     writeln('Drive ',upcase(index),': DPB data in memory');
  143.     showdpbdata(DP);
  144.   end
  145.   else
  146.   begin
  147.     writeln;
  148.     writeln('Drive ',upcase(index),': access failed or drive invalid.  Error ',hi(G),':',lo(G));
  149.     halt;
  150.   end;
  151.  
  152.  
  153.   write('Press ENTER to get *NEW* DPB data');
  154.   readln;clrscr;
  155.  
  156.   G := GETDPB(index,DP,true);
  157.   if (G = 0) then {TRUE means hit the disk}
  158.   begin
  159.     writeln;
  160.     writeln('Drive ',upcase(index),': DPB data from direct disk access');
  161.     showdpbdata(DP);
  162.   end
  163.   else
  164.   begin
  165.     writeln;
  166.     writeln('Drive ',upcase(index),': access failed or drive invalid.  Error ',hi(G),':',lo(G));
  167.     halt;
  168.   end;
  169. END.